(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[     15623,        385]
NotebookOptionsPosition[     15038,        361]
NotebookOutlinePosition[     15448,        379]
CellTagsIndexPosition[     15405,        376]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
 RowBox[{"\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"Clear", "[", "\"\<`*\>\"", "]"}], "\[IndentingNewLine]", 
   "\[IndentingNewLine]", 
   RowBox[{"NotebookEvaluate", "[", 
    RowBox[{
     RowBox[{"NotebookDirectory", "[", "]"}], "<>", "\"\<Model_core.nb\>\""}],
     "]"}]}]}]], "Input",
 CellChangeTimes->{{3.691475820546447*^9, 3.6914758208132353`*^9}, {
  3.717083239235511*^9, 3.717083239828614*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", 
   RowBox[{
   "Find", " ", "best", " ", "response", " ", "of", " ", "B", " ", "for", " ",
     "a", " ", "given", " ", "TA"}], "*)"}], "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"TA", "=", " ", "0.110"}], "\[IndentingNewLine]", 
   RowBox[{"TB", "=", " ", "0.486"}], "\[IndentingNewLine]", 
   RowBox[{"omega", "=", 
    RowBox[{"spe", "[", 
     RowBox[{"TA", ",", "TB"}], "]"}]}], "\[IndentingNewLine]", 
   RowBox[{"If", "[", 
    RowBox[{
     RowBox[{
      RowBox[{"(", 
       RowBox[{
        RowBox[{
         RowBox[{"spe", "[", 
          RowBox[{"TA", ",", "TB"}], "]"}], "\[Equal]", 
         RowBox[{"{", 
          RowBox[{"uhA", ",", "uhB"}], "}"}]}], "&&", " ", 
        RowBox[{"TB", "<", "TA"}]}], ")"}], "||", 
      RowBox[{"(", 
       RowBox[{
        RowBox[{
         RowBox[{"spe", "[", 
          RowBox[{"TA", ",", "TB"}], "]"}], "\[Equal]", 
         RowBox[{"{", 
          RowBox[{"lhA", ",", "lhB"}], "}"}]}], "&&", " ", 
        RowBox[{"TB", ">", "TA"}]}], ")"}]}], ",", "0", ",", 
     "\[IndentingNewLine]", 
     RowBox[{"VB", "[", 
      RowBox[{
       RowBox[{"Median", "[", "HB", "]"}], ",", "TA", ",", "TB", ",", 
       RowBox[{
        RowBox[{"spe", "[", 
         RowBox[{"TA", ",", "TB"}], "]"}], "[", 
        RowBox[{"[", "1", "]"}], "]"}], ",", 
       RowBox[{
        RowBox[{"spe", "[", 
         RowBox[{"TA", ",", "TB"}], "]"}], "[", 
        RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], "]"}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{"(*", 
    RowBox[{
    "Find", " ", "best", " ", "response", " ", "of", " ", "A", " ", "for", 
     " ", "a", " ", "given", " ", "TB"}], "*)"}], "\[IndentingNewLine]", 
   RowBox[{"TB", "=", " ", "0.486"}], "\[IndentingNewLine]", 
   RowBox[{"TA", "=", " ", "0.110"}], "\[IndentingNewLine]", 
   RowBox[{"omega", "=", 
    RowBox[{"spe", "[", 
     RowBox[{"TA", ",", "TB"}], "]"}]}], "\[IndentingNewLine]", 
   RowBox[{"If", "[", 
    RowBox[{
     RowBox[{
      RowBox[{"(", 
       RowBox[{
        RowBox[{
         RowBox[{"spe", "[", 
          RowBox[{"TA", ",", "TB"}], "]"}], "\[Equal]", 
         RowBox[{"{", 
          RowBox[{"uhA", ",", "uhB"}], "}"}]}], "&&", " ", 
        RowBox[{"TA", "<", "TB"}]}], ")"}], "||", 
      RowBox[{"(", 
       RowBox[{
        RowBox[{
         RowBox[{"spe", "[", 
          RowBox[{"TA", ",", "TB"}], "]"}], "\[Equal]", 
         RowBox[{"{", 
          RowBox[{"lhA", ",", "lhB"}], "}"}]}], "&&", " ", 
        RowBox[{"TA", ">", "TB"}]}], ")"}]}], ",", "0", ",", 
     RowBox[{"VA", "[", 
      RowBox[{
       RowBox[{"Median", "[", "HA", "]"}], ",", "TA", ",", "TB", ",", 
       RowBox[{
        RowBox[{"spe", "[", 
         RowBox[{"TA", ",", "TB"}], "]"}], "[", 
        RowBox[{"[", "1", "]"}], "]"}], ",", 
       RowBox[{
        RowBox[{"spe", "[", 
         RowBox[{"TA", ",", "TB"}], "]"}], "[", 
        RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], "]"}], 
   "\[IndentingNewLine]"}]}]], "Input",
 CellChangeTimes->{{3.691231103570043*^9, 3.691231105817006*^9}, {
   3.6912314546749363`*^9, 3.691231493372108*^9}, {3.691231642527616*^9, 
   3.691231686254305*^9}, {3.6912336221288137`*^9, 3.691233655293154*^9}, {
   3.691233791544806*^9, 3.691233794144814*^9}, 3.6912338555592127`*^9, {
   3.6912341552094316`*^9, 3.6912341663234453`*^9}, {3.69123426475947*^9, 
   3.691234275433736*^9}, {3.691234619765725*^9, 3.691234641498575*^9}, {
   3.69131300155654*^9, 3.691313003705497*^9}, {3.691314432427272*^9, 
   3.6913144354160767`*^9}, {3.691314529284528*^9, 3.69131453406595*^9}, {
   3.69131517311515*^9, 3.691315178409384*^9}, {3.691315565815279*^9, 
   3.691315567046194*^9}, {3.691315833875348*^9, 3.691315835657864*^9}, {
   3.6913161461859903`*^9, 3.691316148360409*^9}, {3.691316437701825*^9, 
   3.691316440179604*^9}, {3.691316904443542*^9, 3.6913169066578712`*^9}, {
   3.6913172701845417`*^9, 3.6913172726569233`*^9}, {3.691317303783719*^9, 
   3.6913173039815903`*^9}, {3.691317350440538*^9, 3.691317375781654*^9}, {
   3.691317635277257*^9, 3.691317635709243*^9}, {3.691317915794161*^9, 
   3.69131791864624*^9}, {3.691318263547161*^9, 3.6913182647353697`*^9}, {
   3.691318611681754*^9, 3.6913186153896914`*^9}, {3.691318940969117*^9, 
   3.691318941878298*^9}, {3.6913192969942417`*^9, 3.6913193115268784`*^9}, {
   3.691320559007433*^9, 3.691320570876564*^9}, {3.6913209402738733`*^9, 
   3.691320948981759*^9}, {3.691323200215184*^9, 3.691323217502339*^9}, {
   3.691323541395933*^9, 3.69132354296972*^9}, {3.691323798417591*^9, 
   3.6913238005034027`*^9}, {3.691324243463092*^9, 3.691324248419244*^9}, {
   3.69132450337348*^9, 3.69132451577039*^9}, {3.691325155749542*^9, 
   3.6913251566638947`*^9}, {3.691384491604836*^9, 3.691384513643853*^9}, {
   3.6913860578378677`*^9, 3.6913860585318003`*^9}, {3.691386328367385*^9, 
   3.691386330052125*^9}, {3.691387037296236*^9, 3.691387038095001*^9}, {
   3.6913894427388487`*^9, 3.69138946295252*^9}, {3.691389997346319*^9, 
   3.691389998144526*^9}, {3.691390468596264*^9, 3.69139047034582*^9}, {
   3.6913909524245033`*^9, 3.691390953902156*^9}, {3.6913996880702133`*^9, 
   3.691399692595806*^9}, {3.691399951157425*^9, 3.6913999525404873`*^9}, {
   3.6914002710161247`*^9, 3.691400272038289*^9}, {3.691400527136539*^9, 
   3.691400528013638*^9}, {3.691400854295939*^9, 3.691400855229713*^9}, {
   3.691401205801836*^9, 3.691401206524267*^9}, {3.691402356232252*^9, 
   3.6914023684471684`*^9}, 3.691402689942732*^9, {3.6914031549713373`*^9, 
   3.691403156728183*^9}, {3.691403427077361*^9, 3.691403427539321*^9}, {
   3.691403659881702*^9, 3.6914036621915607`*^9}, {3.717750144554039*^9, 
   3.717750173837551*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{"Tables", " ", "with", " ", "summary", " ", "of", " ", "results"}],
    "*)"}], "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"TA", "=", " ", "0.110"}], "\[IndentingNewLine]", 
   RowBox[{"TB", "=", " ", "0.486"}], "\[IndentingNewLine]", 
   RowBox[{"omega", "=", 
    RowBox[{"spe", "[", 
     RowBox[{"TA", ",", "TB"}], "]"}]}], "\[IndentingNewLine]", 
   "\[IndentingNewLine]", 
   RowBox[{"TableForm", "[", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{"\"\<Optimal Tax Rate in A\>\"", ",", 
        RowBox[{"N", "[", 
         RowBox[{"cprefA", "/", 
          RowBox[{"Median", "[", "inc", "]"}]}], "]"}], ",", 
        "\"\<Optimal Tax Rate in B\>\"", ",", 
        RowBox[{"N", "[", 
         RowBox[{"cprefB", "/", 
          RowBox[{"Median", "[", "inc", "]"}]}], "]"}]}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{"\"\<Optimal Public Good in A\>\"", ",", 
        RowBox[{"N", "[", 
         RowBox[{"cprefA", "*", 
          RowBox[{
           RowBox[{"Mean", "[", "inc", "]"}], "/", 
           RowBox[{"Median", "[", "inc", "]"}]}]}], "]"}], ",", 
        "\"\<Optimal Public Good in B\>\"", ",", 
        RowBox[{"N", "[", 
         RowBox[{"cprefB", "*", 
          RowBox[{
           RowBox[{"Mean", "[", "inc", "]"}], "/", 
           RowBox[{"Median", "[", "inc", "]"}]}]}], "]"}]}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{
       "\"\<1st Period Tax Rate in A\>\"", ",", "TA", ",", 
        "\"\<1st Period Tax Rate in B\>\"", ",", "TB"}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{"\"\<1st Period Public Good in A\>\"", ",", 
        RowBox[{"TA", "*", 
         RowBox[{"GA", "[", 
          RowBox[{"TA", ",", "TB", ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "1", "]"}], "]"}], ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ",", 
        "\"\<1st Period Public Good in B\>\"", ",", 
        RowBox[{"TB", "*", 
         RowBox[{"GB", "[", 
          RowBox[{"TA", ",", "TB", ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "1", "]"}], "]"}], ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}]}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{"\"\<Average Income in A\>\"", ",", 
        RowBox[{"GA", "[", 
         RowBox[{"TA", ",", "TB", ",", 
          RowBox[{"omega", "[", 
           RowBox[{"[", "1", "]"}], "]"}], ",", 
          RowBox[{"omega", "[", 
           RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",", 
        "\"\<Average Income in B\>\"", ",", 
        RowBox[{"GB", "[", 
         RowBox[{"TA", ",", "TB", ",", 
          RowBox[{"omega", "[", 
           RowBox[{"[", "1", "]"}], "]"}], ",", 
          RowBox[{"omega", "[", 
           RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{"\"\<Median Hedonic Income in A\>\"", ",", 
        RowBox[{"MA", "[", 
         RowBox[{"TA", ",", "TB", ",", 
          RowBox[{"omega", "[", 
           RowBox[{"[", "1", "]"}], "]"}], ",", 
          RowBox[{"omega", "[", 
           RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",", 
        "\"\<Median Hedonic Income in B\>\"", ",", 
        RowBox[{"MB", "[", 
         RowBox[{"TA", ",", "TB", ",", 
          RowBox[{"omega", "[", 
           RowBox[{"[", "1", "]"}], "]"}], ",", 
          RowBox[{"omega", "[", 
           RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{"\"\<2nd Period Tax Rate in A\>\"", ",", 
        RowBox[{"1", "/", 
         RowBox[{"MA", "[", 
          RowBox[{"TA", ",", "TB", ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "1", "]"}], "]"}], ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ",", 
        "\"\<2nd Period Tax Rate in B\>\"", ",", 
        RowBox[{"1", "/", 
         RowBox[{"MB", "[", 
          RowBox[{"TA", ",", "TB", ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "1", "]"}], "]"}], ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}]}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{"\"\<2nd Period Public Good in A\>\"", ",", 
        RowBox[{
         RowBox[{"GA", "[", 
          RowBox[{"TA", ",", "TB", ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "1", "]"}], "]"}], ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "2", "]"}], "]"}]}], "]"}], "*", 
         RowBox[{"(", 
          RowBox[{"1", "/", 
           RowBox[{"MA", "[", 
            RowBox[{"TA", ",", "TB", ",", 
             RowBox[{"omega", "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", 
             RowBox[{"omega", "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ")"}]}], ",", 
        "\"\<2nd Period Public Good in B\>\"", ",", 
        RowBox[{
         RowBox[{"GB", "[", 
          RowBox[{"TA", ",", "TB", ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "1", "]"}], "]"}], ",", 
           RowBox[{"omega", "[", 
            RowBox[{"[", "2", "]"}], "]"}]}], "]"}], "*", 
         RowBox[{"(", 
          RowBox[{"1", "/", 
           RowBox[{"MB", "[", 
            RowBox[{"TA", ",", "TB", ",", 
             RowBox[{"omega", "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", 
             RowBox[{"omega", "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ")"}]}]}], "}"}]}], 
     "}"}], "]"}]}]}]], "Input",
 CellChangeTimes->{
  3.6815252757807817`*^9, {3.681525937959858*^9, 3.681526014490552*^9}, {
   3.681530914712904*^9, 3.68153091638795*^9}, {3.6816367488896933`*^9, 
   3.68163675029208*^9}, {3.6914078954382133`*^9, 3.69140794869289*^9}, {
   3.691407993203412*^9, 3.691408033161084*^9}, 3.691408080996204*^9, {
   3.6914081269145308`*^9, 3.691408177174581*^9}, {3.691408393173423*^9, 
   3.691408402491947*^9}}],

Cell[BoxData["0.11`"], "Output",
 CellChangeTimes->{3.6815260158667097`*^9, 3.68153092656968*^9, 
  3.681636751720632*^9, 3.6914081810144377`*^9, 3.691408413972801*^9}],

Cell[BoxData["0.486`"], "Output",
 CellChangeTimes->{3.6815260158667097`*^9, 3.68153092656968*^9, 
  3.681636751720632*^9, 3.6914081810144377`*^9, 3.691408413974135*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"2.579662242471002`", ",", "2.579662242471002`"}], "}"}]], "Output",
 CellChangeTimes->{3.6815260158667097`*^9, 3.68153092656968*^9, 
  3.681636751720632*^9, 3.6914081810144377`*^9, 3.6914084591883097`*^9}],

Cell[BoxData[
 TagBox[GridBox[{
    {"\<\"Optimal Tax Rate in A\"\>", 
     "0.1245417292239678`", "\<\"Optimal Tax Rate in B\"\>", 
     "0.4981669168958712`"},
    {"\<\"Optimal Public Good in A\"\>", 
     "1.1208755630157103`", "\<\"Optimal Public Good in B\"\>", 
     "4.483502252062841`"},
    {"\<\"1st Period Tax Rate in A\"\>", 
     "0.11`", "\<\"1st Period Tax Rate in B\"\>", "0.486`"},
    {"\<\"1st Period Public Good in A\"\>", 
     "1.1488029112765483`", "\<\"1st Period Public Good in B\"\>", 
     "3.4747540383888436`"},
    {"\<\"Average Income in A\"\>", 
     "10.443662829786803`", "\<\"Average Income in B\"\>", 
     "7.149699667466757`"},
    {"\<\"Median Hedonic Income in A\"\>", 
     "6.608977890359033`", "\<\"Median Hedonic Income in B\"\>", 
     "1.7391658205628522`"},
    {"\<\"2nd Period Tax Rate in A\"\>", 
     "0.15130932749204204`", "\<\"2nd Period Tax Rate in B\"\>", 
     "0.5749883008144483`"},
    {"\<\"2nd Period Public Good in A\"\>", 
     "1.5802235993286777`", "\<\"2nd Period Public Good in B\"\>", 
     "4.110993663130336`"}
   },
   GridBoxAlignment->{
    "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
     "RowsIndexed" -> {}},
   GridBoxSpacings->{"Columns" -> {
       Offset[0.27999999999999997`], {
        Offset[2.0999999999999996`]}, 
       Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
       Offset[0.2], {
        Offset[0.4]}, 
       Offset[0.2]}, "RowsIndexed" -> {}}],
  Function[BoxForm`e$, 
   TableForm[BoxForm`e$]]]], "Output",
 CellChangeTimes->{3.6815260158667097`*^9, 3.68153092656968*^9, 
  3.681636751720632*^9, 3.6914081810144377`*^9, 3.691408461573118*^9}]
}, Open  ]]
},
WindowSize->{1339, 690},
WindowMargins->{{Automatic, 30}, {Automatic, 0}},
PrintingCopies->1,
PrintingPageRange->{1, Automatic},
FrontEndVersion->"9.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (January 25, \
2013)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[557, 20, 426, 10, 80, "Input"],
Cell[986, 32, 5709, 120, 233, "Input"],
Cell[CellGroupData[{
Cell[6720, 156, 6018, 147, 267, "Input"],
Cell[12741, 305, 168, 2, 28, "Output"],
Cell[12912, 309, 169, 2, 28, "Output"],
Cell[13084, 313, 245, 4, 28, "Output"],
Cell[13332, 319, 1690, 39, 149, "Output"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
